<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>家政管理系统-V6.8</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/branch_oa/css/font.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/branch_oa/css/xadmin.css">
        <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/static/branch_oa/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/static/branch_oa/js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body style="background: #fff;">
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form" name="openJiacard">
                  <input type="hidden" name="buid" value="${jsbuid}">
                  <input type="hidden" name="detailedaddress" value="${businessaa.address}">
                  <input type="hidden" name="remarks" value="${businessaa.remarks}">
                  <div class="layui-form-item" style="display: inline-block;">
                      <label for="cardnum" class="layui-form-label">
                          家政卡号：
                      </label>
                      <div class="layui-input-inline">
                          <select id="cardnum" name="cardid" class="valid">
                                  <option >请选择卡号</option>
                                  <c:forEach items="${cardList}" var="cardid">
                                      <option value="${cardid}">${cardid}</option>
                                  </c:forEach>
                          </select>
                      </div>
                  </div>
                    <div class="layui-form-item" style="display: inline-block;">
                        <label  class="layui-form-label">
                            家政卡类型：
                        </label>
                        <div class="layui-input-inline">
                            <select id="cardtype" name="cardtype" class="valid" lay-filter="demo">
                                <option >请选择卡类型</option>
                                <option value="0">小时卡</option>
                                <option value="1">现金卡</option>
                            </select>
                        </div>
                    </div>
                  <div class="layui-form-item" style="display: inline-block;">
                      <label for="money" class="layui-form-label">
                          卡面额：
                      </label>
                      <div class="layui-input-inline">
                          <select id="money" name="cdid" class="valid">
                              <option value="">请选择充值卡面额</option>
                              <c:forEach items="${denominationListss}" var="denominationLists">
                                  <option value="${denominationLists.id}">${denominationLists.denomination}</option>
                              </c:forEach>
                          </select>
                      </div>
                  </div>
                  <div class="layui-form-item" style="display: inline-block;">
                      <label for="price" class="layui-form-label">
                          钟点工价 ：                    
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="price" name="hourlyrate" required="" lay-verify="price"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item" style="display: inline-block;">
                      <label for="ytime" class="layui-form-label">
                          可用工时 ：                    
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="ytime" name="yworkinghours" required="" lay-verify="ytime"
                          autocomplete="off" class="layui-input" disabled="disabled">
                      </div>
                  </div>
                  <div class="layui-form-item" style="display: inline-block;">
                      <label for="stime" class="layui-form-label">
                          剩余工时 ：
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="stime" name="nworkinghours" required="" lay-verify="stime"
                          autocomplete="off" class="layui-input" disabled="disabled">
                      </div>
                  </div>
                    <div class="layui-form-item" style="display: inline-block;">
                        <label for="ytime" class="layui-form-label">
                            可用现金 ：
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="ytmoney" name="ybalance" required="" lay-verify="ytime"
                                   autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                    <div class="layui-form-item" style="display: inline-block;">
                        <label for="stime" class="layui-form-label">
                            剩余现金 ：
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="stmoney" name="nbalance" required="" lay-verify="stime"
                                   autocomplete="off" class="layui-input" disabled="disabled">
                        </div>
                    </div>
                  <div class="layui-form-item" style="display: inline-block;">
                      <label for="endtime" class="layui-form-label">
                          有效期至：
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="endtime" name="period" required="" lay-verify="starttime"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>

                    <div class="layui-form-item" style="display: inline-block;">
                        <label for="stime" class="layui-form-label">
                            客户姓名 ：
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="name" name="name" required="" lay-verify="stime" value="${businessaa.name}"
                                   disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" style="display: inline-block;">
                        <label for="stime" class="layui-form-label">
                            联系方式 ：
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="tel" name="tel" required="" lay-verify="stime" value="${businessaa.tel}"
                                   disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" style="display: inline-block;">
                        <label for="stime" class="layui-form-label">
                            详细住址 ：
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="address" name="stime" required="" lay-verify="stime" value="${businessaa.address}"
                                   disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" lay-filter="add" lay-submit="">
                          开卡
                      </button>
                  </div>

              </form>
            </div>
        </div>
        <script type="text/javascript" src="${pageContext.request.contextPath}/static/branch_oa/js/xcity.js"></script>



        <%--系统script--%>
        <script>
        layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
          elem: '#starttime' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#endtime' //指定元素
        });
      });

        layui.use(['form', 'layer'],


            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;




                //监听提交
                form.on('submit(add)',
                    function(data) {

                        $("#openJiacard")
                        $.ajax({
                            url: "${pageContext.request.contextPath}/ocard/openCard",
                            data:data.field,
                            success: function (res) {
                                if(res){
                                    layer.alert("开卡成功", {
                                        icon: 6
                                    }, function() {


                                        location.href="${pageContext.request.contextPath}/bus/findBusinessBS?bsstate=${hbsstate}";


                                    });
                                }else{
                                    layer.alert("开卡失败", {
                                        icon: 6
                                    }, function() {
                                        //关闭当前frame
                                        xadmin.close();
                                        // 可以对父窗口进行刷新
                                        xadmin.father_reload();
                                    });
                                }
                            }
                        });
                        return false;
                    });


            });
        </script>
        <script>
            layui.use(['layer', 'jquery', 'form'], function () {
                var layer = layui.layer,
                    $ = layui.jquery,
                    form = layui.form;

                form.on('select(demo)', function(data){
                    if(data.value == 0){
                        $("#ytmoney").attr("disabled","disabled");
                        $("#stmoney").attr("disabled","disabled");
                        $("#ytime").removeAttr("disabled");;
                        $("#stime").removeAttr("disabled");;
                        form.render('select');
                    } else if(data.value == 1){
                        $("#ytmoney").removeAttr("disabled");;
                        $("#stmoney").removeAttr("disabled");;
                        $("#ytime").attr("disabled","disabled");
                        $("#stime").attr("disabled","disabled");
                        form.render('select');
                    }else{
                        $("#ytmoney").attr("disabled","disabled");
                        $("#stmoney").attr("disabled","disabled");
                        $("#ytime").attr("disabled","disabled");
                        $("#stime").attr("disabled","disabled");
                        form.render('select');//select是固定写法 不是选择器
                    }
                });
            });
        </script>
        <script>var _hmt = _hmt || []; (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();</script>
    </body>

</html>
